import Mock from 'mockjs'
import qs from 'qs'

const token = '1234567';

Mock.mock('/login', (options) => {
    var optionsBody = qs.parse(options.body);
    var user = { identity: optionsBody.identity, password: optionsBody.password };
    return { user, token };
})

Mock.mock('/api/detective/image/ident/215P', (options) => {
    return {
        success: true,
        dateTime: "2020/11/14",
        msg: "识别成功",
        detectedImagePath: "/abc",
        cabinetId: "215P",
        result: [
            {
                dotDetected: {
                    state: "on",
                    score: 100,
                    x: 1,
                    y: 1,
                    row: 1,
                    column: 1,
                },
                switchInfo: {
                    id: 1,
                    cabinetId: "215P",
                    name: "保护压板1",
                    standardState: "on",
                    note: "无",
                    row: 1,
                    column: 1,
                },
                isCorrect: true
            },
            {
                dotDetected: {
                    state: "off",
                    score: 100,
                    x: 2,
                    y: 2,
                    row: 1,
                    column: 2,
                },
                switchInfo: {
                    id: 2,
                    cabinetId: "215P",
                    name: "保护压板2",
                    standardState: "on",
                    note: "无",
                    row: 1,
                    column: 2,
                },
                isCorrect: false,
            }
        ]
    }
})

Mock.mock('/api/test', (options) => {
    return {
        success: true,
        code: "200",
        message: "成功"
    }
})
